package com.xinghanlaser.applet.base.common.exception;


import com.xinghanlaser.applet.base.common.entity.ResponseEntity;
import com.xinghanlaser.applet.base.common.enums.ResponseCodeEnum;


/**
 * Created by yyym on 2019/9/21.
 */
public class ServiceException extends ApplicationException implements Responsible<Void> {
    
    private ResponseCodeEnum code = ResponseCodeEnum.FAULT_DEFAULT;

    public ServiceException(String message) {
        super(message);
    }

    public ServiceException(ResponseCodeEnum code, String message) {
        super(message);
        this.code = code;
    }

    public ServiceException(String message, Throwable cause) {
        super(message, cause);
    }

    public ServiceException(Throwable cause) {
        super(cause);
    }

    protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    @Override
    public ResponseEntity<Void> response() {
        return ResponseEntity.fault(code, getMessage());
    }
}
